/************************************
*  Copyright (C) 2010 Julien MOTTIN.
*  Contact: julien.mottin@gueydan.eu
*
*  This file is part of Gueydan.
*
*  Gueydan is free software: you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation, either version 3 of the License, or
*  (at your option) any later version.
*
*  Gueydan is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with Gueydan.  If not, see <http://www.gnu.org/licenses/>.
*
*************************************/
#ifndef HOPMODEL_H
#define HOPMODEL_H

// QtCore
#include <QAbstractTableModel>

class Recipe;

class HopModel : public QAbstractTableModel
{
    Q_OBJECT;
public:

    HopModel(Recipe *ipRecipe, QObject * parent=0);
    virtual ~HopModel();


    /*  HopName  HopAlpha   HopAmount   HopUnit
     *   n1         a1         q1          u1
     *   n2         a2         q2          u2
    */

    // Reimplement from QAbstractTableModel
    Qt::ItemFlags flags(const QModelIndex &index) const;
    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
    bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
    QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole);
    bool setHeaderData(int section, Qt::Orientation orientation, const QVariant & value, int role = Qt::EditRole);    
    bool insertRows(int row, int count, const QModelIndex & parent = QModelIndex());
    bool removeRows(int row, int count, const QModelIndex & parent = QModelIndex());
    int rowCount(const QModelIndex & parent = QModelIndex()) const;
    int columnCount(const QModelIndex & parent = QModelIndex()) const;

private:

    // Forbidden
    HopModel(const HopModel &);
    HopModel & operator=(const HopModel &);

    // internal data
    Recipe *_pRecipe;

};

#endif
